www.gusucode.com > 24Beta 虚拟主机版 1.0.0 Beta源码程序 > 24Beta 虚拟主机版 1.0.0 Beta源码程序/24Beta-1.0.0-vhost/protected/modules/admin/controllers/DefaultController.php

    <?php

class DefaultController extends CController
{
    public function init()
    {
        
    }
	public function actionIndex()
	{
		if (0) {
			$this->render('login');
		} else {
			$this->renderPartial('index');
		}
	}
	
	public function actionTop()
	{
	    require app()->basePath . '/config/admin_menu.php';
	    $this->render('top', array('menus'=>$menus));
	}
	
	public function actionLeft()
	{
	    require app()->basePath . '/config/admin_menu.php';
	    $sub = trim($_GET['sub']);
	    $menu = $menus[$sub];
	    $this->render('left', array('menu'=>$menu));
	}
	
	public function actionStart()
	{
	    $this->render('start');
	}
	
	
	public function actionLogin()
	{
	    if (app()->request->isPostRequest) {
	        $clientCode = trim($_POST['validateCode']);
	        if (!CdcBetaTools::validateCode($clientCode)) {
	            $this->redirect(url('/admin/default/login'));
	        }
	        
	        $username = trim($_POST['username']);
	        $password = trim($_POST['password']);
	        $identity = new UserIdentity($username, $password);
    		if ($identity->authenticate()) {
    	       	user()->login($identity);
    	       	$this->redirect(url('/admin/default/index'));
    	   	}
    	   	else {
    	       	$this->redirect(url('/admin/default/login'));
    	   	}
	    }
	    
	    if (!user()->isGuest)
	        $this->redirect(url('/admin/default/index'));
	    $this->render('login');
	}
	
	public function actionLogout()
	{
	    user()->logout();
	    $this->redirect(url('/admin/default/login'));
	}
}